package com.abluedog.c1;

import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

public class GatheringWritesTest {
    public static void main(String[] args) {
        ByteBuffer hello = StandardCharsets.UTF_8.encode("hello ");
        ByteBuffer world = StandardCharsets.UTF_8.encode("world ");
        ByteBuffer 你好 = StandardCharsets.UTF_8.encode("你好");

        try (RandomAccessFile rw = new RandomAccessFile("hello.txt", "rw")) {
            rw.getChannel().write(new ByteBuffer[]{hello, world, 你好});
        } catch (IOException e) {
        }
    }
}
